<template>
  <div class="demo-container">
    <el-row>
      <el-form :model="requestParam"
               label-width="100px">
        <el-col :span="6">
          <el-form-item label="姓名">
            <el-input v-model="requestParam.name"
                      placeholder=""></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-button type="primary">查询</el-button>
          <el-button>重置</el-button>
        </el-col>
      </el-form>
    </el-row>
    <el-table :highlight-current-row="true"
              border
              :header-cell-style="{ background: '#f5f5f5' }"
              :data="tableData.list">
      <el-table-column prop="project_no"
                       label="项目编号"
                       align="center"
                       show-overflow-tooltip>
      </el-table-column>
      <el-table-column label="操作"
                       width="200px"
                       align="center">
        <template slot-scope="scope">
          <el-button type="text">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @current-change="handlePageChange"
                   :current-page="requestParam.page"
                   :page-size="requestParam.page_size"
                   layout="total,sizes,prev, pager, next, jumper"
                   background
                   :total="tableData.total_count"
                   align="center">
    </el-pagination>
  </div>
</template>

<script>
import { ProjectListApi } from "@/services/ProjectCenter";
export default {
  components: {

  },
  data () {
    return {
      requestParam: {
        name: '',
        is_page: 1,
        page: 1,
        page_size: 10
      },
      resetParam: {
        name: '',
        is_page: 1,
        page: 1,
        page_size: 10
      },
      tableData: {
        list: [],
        page: 1,
        total_count: 0
      }
    };
  },
  methods: {
    // 查询
    search () {
      this.requestParam.page = 1
      this.getData()
    },
    // 重置
    reset () {
      let resetParam = JSON.parse(JSON.stringify(this.resetParam));
      this.requestParam = Object.assign(this.requestParam, resetParam);
      this.getData()
    },
    handlePageChange (page) {
      this.requestParam.page = page
      this.getData()
    },
    getData () {
      ProjectListApi.getProjectManageList({
        params: this.requestParam
      }).then(res => {
        if (res.code === 0) {
          this.tableData = res.data
        }
      })
    },
    deleteProject () {
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {

        })
        .catch(() => {

        });
    }
  },
  created () {

  },
  mounted () {

  },
};
</script>

<style scoped lang="scss">
</style>
